package cool.qingqing.result;

import java.util.List;

import org.apache.poi.ss.formula.functions.T;

/**
 * @author 高山青
 * @Date 2021/12/26 - 0:53
 */
public class Result<T> {
	private int code;
	private String msg;

	private List<T> data;



	public Result() {
	}

	public Result(ResultEnum code,List<T> data, String msg) {
		this.code = code.getCode();
		this.data = data;
		this.msg = msg;

	}


	
	public Result(ResultEnum code) {
		this.code = code.getCode();
		this.msg = code.getMessage();

	}


	public Result(List<T> data) {
		this.code = ResultEnum.SUCCEED.getCode();
		this.data = data;
		this.msg = "操作成功";
	}

	public Result(String msg) {
		this.code = ResultEnum.FAIL.getCode();
		this.data = data;
		this.msg = msg;
	}

	public int getCode() {
		return code;
	}

	public Result setCode(ResultEnum code) {
		this.code = code.getCode();
		return this;
	}

	public List<T> getData() {
		return data;
	}

	public Result setData(List<T> data) {
		this.data = data;
		return this;
	}

	public String getMsg() {
		return msg;
	}

	public Result setMsg(String msg) {
		this.msg = msg;
		return this;
	}
}
